from typing import Any, AnyStr, Callable, Collection, Dict, Hashable, Iterator, List, Mapping, NewType, Optional, Iterable
from typing import Sequence, Tuple, TypeVar, Union
from types import SimpleNamespace
from pathlib import Path
import torch
from torch import nn
from torch.optim.optimizer import Optimizer
import numpy as np

__all__ = ['TensorImage', 'Tensors', 'Sizes', 'NPArray', 'NPImage', 'NPArrayList', 'NPDict',
           'NPArrayMask', 'NPArrayableList',
           'PathList', 'PathOrStr', 'ListOrItem', 'OptListOrItem',
           'Iterable', 'Callable', 'Optional', 'Sequence', 'Union',
           'Optimizer']

TensorImage = torch.Tensor
TensorImageSize = Tuple[int,int,int]
Tensors = Union[torch.Tensor, Collection['Tensors']]

LambdaFunc = Callable[[torch.Tensor],torch.Tensor]
LayerFunc = Callable[[nn.Module],None]
ModuleList = Collection[nn.Module]

HookFunc = Callable[[nn.Module, Tensors, Tensors], Any]
LogitTensorImage = TensorImage

Floats = Union[float, Collection[float]]
Sizes = List[List[int]]
ColorList =List[Tuple[int, int, int]]
NPArrayableList = Collection[Union[np.ndarray, list]]
NPArrayList = Collection[np.ndarray]
NPDict = Collection[np.ndarray]
NPArrayMask = np.ndarray
NPArray = np.ndarray
NPImage = np.ndarray

PathList = Collection[Union[Path, List[Path]]]
PathOrStr = Union[Path,str]
ListOrItem = Union[Collection[Any],int,float,str]
OptListOrItem = Optional[ListOrItem]



